/*
 * @Author: ZhanXie
 * @Date: 2019-11-28 09:13:32
 * @LastEditors: ZhanXie
 * @LastEditTime: 2019-11-29 14:43:55
 * @Description: 数据库 配置
 * @FilePath: /node-demo/blog-origin/src/conf/db.js
 */
const env = process.env.NODE_ENV // 环境参数

let MY_SQLCONF
let REDIS_CONF

// 测试环境数据库配置
if (env === "dev") {
  // mysql
  MY_SQLCONF = {
    host: "localhost",
    user: "root",
    password: "Z61524334251",
    prot: "3306",
    database: "myblog"
  }

  // redis
  REDIS_CONF = {
    port: 6379,
    host: "127.0.0.1"
  }
}

// 生产环境数据库配置
if (env === "production") {
  // mysql
  MY_SQLCONF = {
    host: "localhost",
    user: "root",
    password: "Z61524334251",
    prot: "3306",
    database: "myblog"
  }

  // redis
  REDIS_CONF = {
    port: 6379,
    host: "127.0.0.1"
  }
}

module.exports = {
  MY_SQLCONF,
  REDIS_CONF
}
